package com.example.springboot.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.springboot.entity.Order;
import com.example.springboot.mapper.OrderMapper;
import com.example.springboot.service.IOrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService {

    @Resource OrderMapper orderMapper;

    @Override
    public Page<Order> findPage(Page<Order> page, String orderId, Integer orderUser,String orderState){
        return orderMapper.findPage(page,orderId,orderUser,orderState);
    }

    @Override
    public List<Order> listState(Integer orderUser, String orderState) {
        QueryWrapper objectQueryWrapper = new QueryWrapper();
        objectQueryWrapper.eq("order_user", orderUser);
        objectQueryWrapper.eq("order_state", orderState);
        List<Order> orders = this.orderMapper.selectList(objectQueryWrapper);
        return orders;
    }
}
